﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace Fitment.Admin
{
    public partial class admin : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LoginUser"] == null)    //上面Session名字用LoginUser,这里的名字要和上面的相同,可以随便改,保持一致就行了,注意:Session["LoginUser"]后面,没有ToString()哦,你要是加上的话,就会出错了.
            {
                Response.Redirect("logon.aspx"); //如果Session为空,则转到登陆页.
            }
            this.user.Text = Session["LoginUser"].ToString();  //赋值给标签
        }

        protected void LogoutLinkButton_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();  //登出页面并释放所有session
            Session.Abandon();
            Response.Redirect("logon.aspx");      
        }
    }
}
